Repository navigation
fix(test): stop processes a test run leaves in its temp directory - #4093
Conversation
Vitest global teardown and the node --test wrapper removed the run directory without stopping processes that still held it as TMPDIR, so fixture daemons from killed or timed-out tests ran for weeks. Teardown now SIGKILLs the orphaned Node processes still in the run directory and reports them. Shared tools a test started (adb, emulator) and processes whose parent still runs are left alone. The check-affected execution tests also kill the recorded command group when they fail before learning its pid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
At b985f53 I found no blocking problems in the code. All 21 checks pass, and the ubuntu "Check the tmpdir redirection model" step plus every Vitest and Not blocking, take or leave: the SIGKILL loop in The four Cubic threads that still apply: the missing descendant orphans (#4093 (comment)), the signal path skipping the stop (#4093 (comment)), and the Before merge, please answer those threads. |
Address review: a root is now a Node process in the run directory whose parent is neither the run owner nor another run process, so subreapers and a PID 1 runner are handled, and each root's descendants are stopped too. Reuse the host-kit process table and signal helpers. The vitest teardown always removes the directory and restores env, and the node --test wrapper waits for its child after a forwarded signal, then stops leftovers; a second signal still exits at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed at 8a3d724:
|
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Pass probe paths through env and argv instead of building them into source, publish pid files by rename so a reader never sees pid 0, and interrupt a still-running wrapper before SIGKILL in cleanup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The code looks good at 598c4b1. The fixes for the earlier findings (#4093 (comment)) are in, and nothing from that review remains open. All 21 checks pass at this commit, and the changed teardown runs in every Vitest and node --test lane, with the ubuntu tmpdir-model step exercising it directly. There are no conflicts. Not blocking, and fine to take or leave: in https://github.com/callstack/agent-device/blob/598c4b1/scripts/check-tmpdir-leaks-model.ts#L72 the consumer set comes from the /proc (or The inline threads from other reviewers are all fixed at this head and already resolved: #4093 (comment) (global-setup cleanup after rejection), #4093 (comment) (descendants now stopped), #4093 (comment) (signal forwarding and exit code), #4093 (comment) (PID 1 runner children spared), #4093 (comment) (no value spliced into code), #4093 (comment) (signal-test cleanup order), #4093 (comment) (pid guard and rename publish). I read the code and the CI results but did not run the new tests or |
Summary
Test runs left fixture processes running for weeks. On one host, 13 orphaned fake daemons and a validation command group were still alive 5–16 days after their runs ended.
Vitest global teardown and the
node --testwrapper removed the run directory without stopping processes that still held it asTMPDIR. Teardown now stops leftover process trees and lists them on stderr. A root is a Node process in the run directory whose parent is neither the run owner nor another run process. Its descendants are stopped with it. This covers subreapers and a PID 1 runner. Shared tools such as adb or an emulator run another executable, so teardown leaves them alone. The wrapper stops leftovers only after its child exits, including after a forwarded Ctrl-C. Teardown always removes the directory.The
check-affectedexecution tests now kill the recorded command group when they fail before learning its PID.6 files, test tooling only. No linked issue.
Validation
pnpm check:tmpdir-leaks:test: 28/28 at 598c4b1. The new wrapper tests (a fixture tree with a surviving non-Node tool, and an interrupted wrapper) fail at b985f53.pnpm check:affected --run --head b985f53176: passed (66 checks).unitcheck failed, at load average 40–73. At 598c4b1 all 1,849 test files pass; the only failures are unhandled errors fromexplicit-lifecycle-fixture.ts. Those errors reproduce with the base teardown files, and the changed code runs only after all workers exit. The CI unit lane at this head is the evidence./procpath.🤖 Generated with Claude Code